import com.marc.util.ContentBehavior;
import com.marc.imageContent.ImageViewer;

import LuminicBox.Log.*;
import com.mosesSupposes.fuse.*;
/**
 * @author |\/| /\ |/ (
 */
class com.marc.imageContent.SingleImage extends ImageViewer implements ContentBehavior {


	public var preloadID:Number;
//	function dispatchEvent() {};
// 	function addEventListener() {};
// 	function removeEventListener() {};
	public function SingleImage(base:MovieClip, 
                               depth:Number, 
                               _filename:String,
                               x:Number, 
                               y:Number, 
                               mask_w:Number, 
                               mask_h:Number){
        //First, super class constructor;
        super(base,depth,_filename,x,y,mask_w,mask_h);
        //Tweening Engine
        ZigoEngine.simpleSetup(Shortcuts,PennerEasing);
        //init logger;
        log=new Logger("sigleImg");
        log.addPublisher( new ConsolePublisher() );
        //init brocast
		mx.events.EventDispatcher.initialize(this);
   	}
   	public function init(){};
   	
  /* 	function sendMessage(p_msgtxt:String):Void {
  		// set up the event object:
  		var eventObj:Object={target:this,type:"message"};
  		eventObj.msgtxt = p_msgtxt;
  		// dispatch the event
  		dispatchEvent(eventObj);
  	}*/
  	//called when the image is loaded. maybe show thumbnail or hide it;
	public function dataReady() : Void {
		
		trace("dataReady");
		container_mc.image_mc._alpha=0;
		container_mc.mask_mc._width =0;
		container_mc.mask_mc._height= container_mc.image_mc._height;
	}
	//called if multiple images loaded using the same preloader.
	public function allDataReady():Void{
		
		container_mc.mask_mc._width =0;
		showUp();
	}
	
	public function showUp() : Void {
		trace("showUp");
		//container_mc.image_mc._alpha=100;
		ZigoEngine.doTween( container_mc.image_mc,"_alpha",100,0.5,"easeInOutSine",0);
		ZigoEngine.doTween( container_mc.mask_mc,"_width,_height",[ow,oh],1,"easeInOutSine",0);
	}
	public function disappear() : Void {
		ZigoEngine.doTween( container_mc.mask_mc,"_width",0,1,"easeInOutSine",0);
	}
	public function remove() : Void {
		
	}
}